home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Aventura
/
FireMan.swf
/
scripts
/
frame_1055
/
PlaceObject2_518_129
/
CLIPACTIONRECORD onClipEvent(enterFrame).as
next >
Wrap
Text File
|
2008-09-12
|
6KB
|
261 lines
onClipEvent(enterFrame){
function hitPlatforms()
{
suelo = true;
if(!mapa.hitTest(_X - 2,_Y,true) && horizontal < 0 || !mapa.hitTest(_X + 2,_Y,true) && horizontal > 0)
{
suelo = false;
horizontal = 0;
}
return undefined;
}
function setScale()
{
if(hide && !(b1._visible || b2._visible || b3._visible))
{
if(_X <= heroe._x)
{
_xscale = Math.abs(_xscale);
}
else
{
_xscale = -1 * Math.abs(_xscale);
}
}
}
function setSpeed()
{
if(walk)
{
if(_xscale > 0)
{
return SPEED;
}
return -1 * SPEED;
}
}
function wallizq()
{
return mapa.hitTest(_X - 23,_Y - 24,true);
}
function wallder()
{
return mapa.hitTest(_X + 23,_Y - 24,true);
}
function Paredes()
{
if(wallder() && horizontal > 0)
{
horizontal = 0;
wall = true;
}
if(wallizq() && horizontal < 0)
{
horizontal = 0;
wall = true;
}
}
function doexplode()
{
myColor.setTransform(myColorNormal);
this.gotoAndStop("death");
}
function dorespawn()
{
currentdamage = 0;
currenthigh = 0;
hitted = false;
flashing = false;
timerdamage = 0;
death = false;
this.gotoAndStop("hide");
hide = true;
attack = walk = wake = prewalk = false;
horizontal = vertical = 0;
_X = xi;
_Y = _root.mapa._y - yi - heroe.vscrollspeed;
shoot = new Sound();
shoot.attachSound("metoolshoot");
}
function drawframe()
{
if(hide)
{
this.gotoAndStop("hide");
return undefined;
}
if(wake)
{
this.gotoAndStop("wake");
return undefined;
}
if(attack || prewalk)
{
this.gotoAndStop("attack");
return undefined;
}
if(walk)
{
this.gotoAndStop("walk");
return undefined;
}
}
xi -= heroe.scrollspeed;
_X = _X - heroe.scrollspeed;
_Y = _Y - heroe.vscrollspeed;
_visible = false;
hitable = this.hitTest(_root.mascara);
if(hitable)
{
_visible = true;
if(this.sprite.hotzone.hitTest(heroe.sprite.hotzone))
{
heroe.damage = 2;
heroe.hitted = true;
}
if(this.sprite.hotzone.hitTest(_root.shoot1) && hitable && !us)
{
_root.shoot1.impact = true;
us = true;
if(!shield)
{
hitted = true;
_root.hitted.start();
}
else
{
_root.escudo.start();
shieldtimer = 5;
_root.frebote._x = _X;
_root.frebote._y = _root.shoot1._y + 4;
_root.frebote.gotoAndPlay(2);
}
}
if(shieldtimer != 0)
{
shieldtimer--;
}
if(shieldtimer <= 0)
{
us = false;
_root.shoot1.impact = false;
}
if(timerdamage == 0 && hitted)
{
timerdamage = FLASHTIME;
currentdamage += DAMAGE;
}
if(timerdamage > 0)
{
flashing = true;
timerdamage % 3 != 0 ? myColor.setTransform(myColorNormal) : myColor.setTransform(myColorTransform);
timerdamage--;
}
if(flashing && timerdamage == 0)
{
flashing = false;
myColor.setTransform(myColorNormal);
hitted = false;
}
if(currentdamage >= MAXDAMAGE)
{
myColor.setTransform(myColorTransform);
death = true;
delete shoot;
}
if(death)
{
_root.shoot1.impact = false;
rising = falling = false;
doexplode();
}
}
if(!death)
{
if(hide)
{
if(timer)
{
timer--;
}
shield = true;
horizontal = 0;
if(Math.abs(heroe._x - _X) <= 60 && Math.abs(heroe._y - _Y) <= 200 && !timer)
{
attack = attacking = false;
hide = false;
wake = true;
shield = false;
timer = 10;
}
}
if(wake)
{
timer--;
if(!timer)
{
wake = false;
attack = true;
timer = 5;
}
}
if(attack)
{
timer--;
if(!timer)
{
attack = false;
prewalk = true;
timer = 4;
this.attachMovie("bullet","b1",1);
this.attachMovie("bullet","b2",2);
this.attachMovie("bullet","b3",3);
shoot.start();
b1.control.dx = -1 * SPEED * 2.5;
b1.control.dy = -1 * SPEED * 2.5;
b1._x = 20;
b1._y = -13;
b2.control.dx = -1 * SPEED * 3.5;
b2._x = 20;
b2._y = -13;
b3.control.dx = -1 * SPEED * 2.5;
b3.control.dy = SPEED * 2.5;
b3._x = 20;
b3._y = -13;
}
}
if(prewalk)
{
timer--;
if(!timer)
{
prewalk = false;
walk = true;
timer = WALKTIME;
}
}
if(walk)
{
timer--;
horizontal = setSpeed();
Paredes();
hitPlatforms();
if(!timer || !suelo || wall)
{
horizontal = 0;
walk = false;
hide = true;
timer = DELAY;
}
}
_Y = _Y + vertical;
_X = _X + horizontal;
setScale();
drawframe();
}
else if(!_root.mascara.hitTest(xi,_Y) && !(b1._visible || b2._visible || b3._visible))
{
dorespawn();
}
}